//package org.example.backend.demos.web.ManagementModule.service.impl;
//
//import org.example.backend.demos.web.User.dao.AuthDao;
//import org.example.backend.demos.web.User.entity.Auth;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.stereotype.Service;
//
//@Service
//public class UserDetailsServiceImpl implements UserDetailsService {
//
//    @Autowired
//    private AuthDao authDao;
//
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        Auth auth = authDao.queryByUsername(username);
//
//        if (auth == null) {
//            throw new UsernameNotFoundException("User not found with username: " + username);
//        }
////        List<GrantedAuthority> authorities = Arrays.stream(user.getRole().split(",")).map(SimpleGrantedAuthority::new).collect(Collectors.toList());
//        return org.springframework.security.core.userdetails.User.builder().username(auth.getUsername()).password(auth.getPassword())
//                .build();
//    }
//}
